
package com.shangsi.controller;

import com.shangsi.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * springmvc官方文档
 *https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-config-customize
 * 难道说打成war包必须得有web目录？有点懵逼，不过web.xml完全不必了都干掉
 * Facets中配置的web目录的根
 * Artifacts中需要配置打包成war
 *
 * web下的全都不需要
 * @author dzd
 * @date 2021-12-12
 */
@Controller
public class HelloController {

    @Autowired
    private HelloService helloService;

    @ResponseBody
    @RequestMapping("/hello")
    public String hello(@RequestParam("str") String str){
      return   helloService.say(str);
    }

    @ResponseBody
    @RequestMapping("/hehe")
    public String hehe(){
        return  "hehe";
    }
}
